<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Config;

class Goods extends Api
{

    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    public function _initialize()
    {
        parent::_initialize();

        if (!Config::get('fastadmin.usercenter')) {
            $this->error(__('User center already closed'));
        }

    }


    /*
     * 分类
     * */
    public function index()
    {
        // 获取信息
        $data = $this->request->param('request_data');
        $data_json = base64_decode($data); //数据解密
        $data_array = json_decode($data_json,true);
        $res  = model('Goods')->cate($data_array);
        $this->success('查询成功', $res);
    }


    /*
     * 详情
     * */
    public function detail()
    {
        // 获取信息
        $data = $this->request->param('request_data');
        $data_json = base64_decode($data); //数据解密
        $data_array = json_decode($data_json,true);
        $res  = model('Goods')->details($data_array);
        if($res['code'])
        {
            $this->success($res['msg'], $res['data']);
        }else{
            $this->error($res['msg'],$res['data']);
        }
    }





}